// 播放量处理
function formatCount(count) {
	let counter = parseInt(count)
	if (counter > 100000000) {
		return (counter / 100000000).toFixed(1) + '亿'
	} else if (counter / 10000) {
		return (counter / 10000).toFixed(1) + '万'
	} else {
		return counter + ''
	}
}

// 时间处理
function padLeft(time) {
  time = time + ""
  return ("00" + time).slice(time.length)
}

function formatTime(timestamp) {
	// 先把时间戳转换成秒
	let date = timestamp / 1000
	// 分钟
	let m = Math.floor(date / 60)
	// 秒
	let s = Math.floor(date % 60)
	let minute = m.toString().padStart(2, '0')
	let second = s.toString().padStart(2, '0')
	return padLeft(minute) + ":" + padLeft(second)
}

export {
	formatCount,
	formatTime
}
